package spring.bean.qualifier;

import org.springframework.context.annotation.*;

/**
 * Created by kassadin@foxmail.com on 2017/4/24 0024.
 */
@Configuration
public class PrimaryConfig {

    @Bean
    @Primary
    public User getUser() {
        return new User("小明primary", 15);
    }

    @Bean
    public User getUser2() {
        return new User("小红", 14);
    }

    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(PrimaryConfig.class);
        User bean = ctx.getBean(User.class);
        System.out.println(bean);
    }
}
